import request from '@/utils/request'

export function pageList(params) {
  return request({
    url: 'dish/page',
    method: 'get',
    params
  })
}

// 菜品详情
export function getMenuDetail(id) {
  return request({
    url: `dish/${id}`,
    method: 'get'
  })
}

// 菜品分类列表
export function getCategoryList() {
  return request({
    url: 'category/list?type=1',
    method: 'get'
  })
}

export function addMenu(data) {
  return request({
    url: 'dish',
    method: 'post',
    data
  })
}

export function updateMenu(data) {
  return request({
    url: 'dish',
    method: 'put',
    data
  })
}

export function deleteMenu(data) {
  return request({
    url: 'dish?ids=' + data,
    method: 'delete'
  })
}

export function disableMenu(data) {
  return request({
    url: 'dish/status/0?ids=' + data,
    method: 'post'
  })
}

export function enableMenu(data) {
  return request({
    url: 'dish/status/1?ids=' + data,
    method: 'post'
  })
}
